package com.didi.gulimall.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.didi.gulimall.common.to.SkuHasStockVo;
import com.didi.gulimall.common.utils.PageUtils;
import com.didi.gulimall.common.vo.OrderItemVo;
import com.didi.gulimall.ware.vo.WarehousingVO;
import com.didi.gulimall.ware.entity.WareSkuEntity;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author didi
 * @email 1062664904@qq.com
 * @date 2021-01-14 16:10:36
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 批量入库
     * @param warehousings
     */
    void addStock(List<WarehousingVO> warehousings);

    void saveWareSku(WareSkuEntity wareSku);

    void updateWareSku(WareSkuEntity wareSku);

    /**
     * 查sku是否有库存
     * @param skuIds
     * @return
     */
    List<SkuHasStockVo> getSkusHasStock(List<Long> skuIds);

    Map<Long, Boolean> getSkusHasStockbByCartItem(List<OrderItemVo> orderItemVos);

    List<Long> listWareIdHasSkuStock(Long skuId, Integer count);

    Long lockSkuStock(Integer num, Long skuId, Long wareId);

    void unLook(Long skuId, Long wareId, Integer num, Integer hasStock);

    void deductionInventory(Long skuId, Long wareId, Integer skuNum);
}

